<form name="form1" action="/polls/vote/pollresult/" method="post" onsubmit="return checkOptions('form1','option');">
<?php if(count($ctx->listquestions) !=0) { ?>
<table width="230" border="0" cellspacing="0" cellpadding="0" align="center">
                          <tr>
                            <td>
                            	<h1>Today's Poll</h1>
                            </td>
                          </tr>
                          <tr>
                          	<td>
                            <?php  $question = $ctx->listquestions[0]['question']?>
<?php  $questionid = $ctx->listquestions[0]['question_id']?>
                            	<strong><?=$question?></strong>
                            </td>
                          </tr>
                          <tr>
                          	<td align="center">
                            	<table width="100%" border="0" cellspacing="0" cellpadding="1">
                                  <tr tal:repeat="listoptions listoptions">
                                    <td width="10%" align="left">
                                    <?php  $id = $ctx->listoptions['id']?>
                                    <input name="option" id="option<?=$id?>" value="<?=$id?>" type="radio" />&nbsp;
                                    ${listoptions/options}
                                    <input name="pollid" value="<?=$questionid?>" type="hidden" />
                                    </td>
                                  </tr>
                                </table>
                            </td>
                          </tr>
                          <tr>
                          	<td align="right"><input name="submit" type="submit" class="input_bt" value="Vote" />&nbsp;<input type="button" class="input_bt" value="View Result" onclick="result();" /></td>
                          </tr>
                          <tr><td>&nbsp;</td></tr>
                        </table>
</form>
<?php } else { ?>
<table width="230" border="0" cellspacing="0" cellpadding="0" align="center">
<tr>
<td>
<h1>This Week's Poll</h1>
</td>
</tr>
<tr><td>&nbsp;</td></tr>
<tr>
<td align="center">No Polls Activated</td>
</tr>
<tr><td>&nbsp;</td></tr>
</table>
<?php } ?>
<script type="text/javascript">
function result()
{
window.location = '/polls/vote/pollpercent/<?=base64_encode($questionid);?>';
}
</script>
<script>
function checkOptions (frmName, rbGroupName) {

	if(lg == true) {
	 var radios = document[frmName].elements[rbGroupName];
     var radioChecked = false;
	 
	 for (var i=0; i < radios.length; i++) {
	  if (radios[i].checked) {
		   radioChecked = true;		   
		   break;
	  }else {
		   radioChecked = false;
	  }	   
	 } 	 
	 
	 if(radioChecked == true) {

	 } else {
 		  alert('You forgot to select an option!');		
		  return false;
	 }
	 } else {
		if(confirm('You need to be logged in to vote.')) 
			window.location = '/utilities/utility/trackback';
		return false;
	 }
	
}

</script>